<html>
<head>
    <meta charset="utf-8"/>
</head>
<body>

<?php
/**
 * Created by PhpStorm.
 * User: Андрей
 * Date: 03.12.2014
 * Time: 18:24
 */
include 'vendor/autoload.php';

$cat = new \Orm\CategoryRepo();
$arr = $cat->findAll();
$fid = $cat->find(2);
//$arradd = array("title" => 'Tits',"summary" => 'Many tits!!!!',"parent_id" => 16);
//$arrup = array("id" => 15,"summary" => 'need more TITS!!!!',"parent_id" => 23);
//$newel = array("title" => 'THE FUCK',"summary" => 'god damn new',"parent_id" => 5,"id" => 0);
//$farrby = array("parent_id" => 4, "title" => 'Алкоголь');
//$farrbyId = array('id' =>)
//$fby = $stmt->findBy($farrby);

//$stmt->add($arradd);
//$stmt->delete(16);
//$stmt->update($arrup);
//$stmt->save($arrup);
//$stmt->save($newel);

echo '<pre>';
print_r($fid);
echo '<br/><hr/>';
echo '</pre>';
echo '<hr/>';

//print_r($fby);
//echo '<br/><hr/>';

foreach ($arr as $val){
    echo '<pre>';
    print_r($val);
    echo '</pre>';
    echo '<hr/>';
}
die();
echo '----------------------------------------------- prod test -----------------------------------------------------<br/>';
$prodRepo = new \Orm\ProductRepo();
$p_arr = $prodRepo->findAll();
$find_prod_byID = $prodRepo->find(1);

print_r($find_prod_byID);

echo '<br/><hr/>';

$fid = $stmt->find(2);
foreach ($p_arr as $val){
    foreach ($val as $key=>$value){
        echo $key . ' ' . $value . '<br/>';
    }
    echo '<hr/>';
}

$byArr = ['title'=>'bottle'];

$wowArr = array(
    'title' => 'Макароны',
    'parent_id' => '10'
);

//$find_by_prod = $prodRepo->findBy($byArr);
//echo 'tyt<br>';
//print_r($find_by_prod);
//echo 'tyt<br>';

$find_by_prod = $prodRepo->findBy($wowArr);
echo '<br/>';
//print_r($find_by_prod);
foreach ($find_by_prod as $k=>$val){
        echo print_r($val) . ' ' . $k . '<br/>';
}

?>


</body>
</html>